Skip to content

SDK v2 development #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Apr 5, 2021
Merged

SDK v2 development #26

merged 38 commits into from
Apr 5, 2021

Conversation

fatihkurtoglu
Copy link
Contributor

Python SDK v2.0 development completed.

More details are available in the migration guide and will be provided in Release Notes.
You can refer to the internal PRD as well.

High level summary:

  • Object model updates:

    • Task/Batch/Project models updated
    • A new method as_dict() introduced to access object as a dict
  • New ways to retrieve the list of tasks/batches:

    • Users don't need to handle pagination and tokens/offsets/timeouts anymore
    • tasks_list and batches_list are the new generator methods for bulk retrieval
    • Deprecated some methods to avoid naming confusion
  • API:

    • Isolated API access into a different class
    • Enabled HTTP retry for certain error codes
    • Improved error handling by differentiating exception types
  • Infra improvements:

    • Enabled type hinting across the package
    • New code standards applied via Pylint, flake8 and black
    • Integrated pre-commit for a better/consistent developer experience
    • publish.sh introduced for an automated publish to PyPI
    • New pytest test cases are added
    • Updated setup.py for v2
  • Documentation

    • New Migration guide for v2
    • New Developer Guide (how to setup repo env and configure pre-commit)
    • Updated deployment and publishing guide
    • Updated README for v2
    • Made README to be available in PyPI

Testing results with pytest:

======================================== test session starts =========================================
platform darwin -- Python 3.6.12, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /Users/fatihkurtoglu/git/scaleapi-python-client
collected 31 items                                                                                                                                                                                   

tests/test_client.py ..............................                                             [100%]
======================================== 31 passed in 18.31s =========================================

Copy link
Contributor

@shaun-scale shaun-scale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left small comments - only big comment, and maybe it's too late.. I think I prefer all_tasks to tasks_all but if it is too late... (I think it might be.. 😅 ) - I'm fine.

@fatihkurtoglu
Copy link
Contributor Author

Left small comments - only big comment, and maybe it's too late.. I think I prefer all_tasks to tasks_all but if it is too late... (I think it might be.. 😅 ) - I'm fine.

@shaun-scale
No, it's not too late. Actually, there is a bit gray area on how to name those methods (get/fetch/list/retrieve/$s).

Existing methods were named as tasks and projects (as named per endpoint). I also renamed list_batches to batches to be consistent with the existing naming.

For naming new yield/generator methods, some prefer _yield or _gen suffixes, making sense for differentiation but more developer-oriented. I'm open to discussing that, and it's not a big change either.

We can use all as a pre-fix as well, and this is better for grammar! I was thinking of an auto-complete scenario where IDE provides the other method when a dev types client.task

Another alternative is to use get_tasks() and get_batches() since we already have singular versions to retrieve one, and plural ones can serve to retrieve the list.

@shaun-scale
Copy link
Contributor

I think I like the plural versions (get_tasks() and get_batches(), etc.) - seems very readable and clear, plus would help with the auto-completion :)

@fatihkurtoglu fatihkurtoglu merged commit 22827ba into master Apr 5, 2021
@fatihkurtoglu fatihkurtoglu deleted the dev-2.0 branch April 5, 2021 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants